program test;
var 
	arr:array[1..10] of integer;
	a, b, c, i:integer;
procedure add;
begin
	c:=a+b;
end;
procedure mul;
begin
	c:=a*b;
end;
begin 
	for i:=1 to 10 do
	begin
		a[i] := i;
	end;
	for i:=1 to 9 do
	begin
		a := arr[i];
		b := arr[i+1];
		add;
		a[i] := c;
	end;
	for i:= 10 downto 1 do
	begin
		a := arr[i];
		b := arr[i-1];
		mul;
		a[i] := c;
	end;
end.